import format from 'date-format';

const _format = function(date: Date) {
  let MM = format('MM', date);
  let dd = format('dd', date);
  let hhmm = format('hh:mm', date);
  let currentMM = format('MM', new Date());
  let currentdd = format('dd', new Date());
  let str = `${MM}-${dd} ${hhmm}`;
  if(MM === currentMM && dd === currentdd) {
    str = `今天 ${hhmm}`;
  } else if(MM === currentMM && dd === currentdd - 1) {
    str = `昨天 ${hhmm}`;
  }
 
  return str;
}
export default _format;
  
